package com.leostadyn.stackfarm.timestatistics.model.bean;

import android.os.Parcel;
import android.os.Parcelable;

public class LoginBean implements Parcelable {

    private boolean admin;
    public static final Creator<LoginBean> CREATOR = new Creator<LoginBean>() {
        @Override
        public LoginBean createFromParcel(Parcel in) {
            return new LoginBean(in);
        }

        @Override
        public LoginBean[] newArray(int size) {
            return new LoginBean[size];
        }
    };
    private String token;
    private boolean user;

    public LoginBean(boolean admin, boolean user, String token) {
        this.admin = admin;
        this.user = user;
        this.token = token;
    }

    protected LoginBean(Parcel in) {
        admin = in.readByte() != 0;
        user = in.readByte() != 0;
        token = in.readString();
    }

    public boolean isAdmin() {
        return admin;
    }

    public void setAdmin(boolean admin) {
        this.admin = admin;
    }

    public boolean isUser() {
        return user;
    }

    public void setUser(boolean user) {
        this.user = user;
    }

    public String getToken() {
        return token;
    }

    public void setToken(String token) {
        this.token = token;
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeByte((byte) (admin ? 1 : 0));
        dest.writeByte((byte) (user ? 1 : 0));
        dest.writeString(token);
    }
}
